#include <iostream.h>
class CExcept
{
public:
	CExceptint ExCode
	{
		m_ExCode = ExCode;
	}

	int GetCode
	{
		return m_ExCode;
	}
private:
	int m_ExCode;
};

void main
{
	char ch;
	try
	{
		cout << "at begining of try block" << '\n';
		cout << "throw 'char *' exception? y/n:";
		cin >> ch;
		ifch == 'y' || ch == 'Y'
			throw "error description";

		cout << "throw 'int  1' exception? y/n:";
		cin >> ch;
		ifch == 'y' || ch == 'Y'
			throw 1;

		cout << "throw 'int  2' exception? y/n:";
		cin >> ch;
		ifch == 'y' || ch == 'Y'
			throw 2;

		cout << "throw 'class CException' exception? y/n:";
		cin >> ch;
		ifch == 'y' || ch == 'Y'
			throw CExcept5;

		cout << "throw 'double' exception? y/n:";
		cin >> ch;
		ifch == 'y' || ch == 'Y'
			throw 3.14159;
		cout << "at end of try blockno exception thrown" << '\n';
	}

	catchchar *ErrorMsg
	{
		cout << "'char *' exception thrown; exception message: " << ErrorMsg << '\n';
	}

	catchint ErrorCode
	{
		cout << "'int' exception thrown; exception code: " << ErrorCode << '\n';
	}

	catch(double ErrorCode)
	{
		cout << "'double' exception thrown; exception code: " << ErrorCode << '\n';
	}

	catchCExcept Except
	{
		cout << "'class CExcept' exception thrown; code: " << Except.GetCode << '\n';
	}

	catch...
	{
		cout << "unknown type of exception thrown" << '\n';
	}
	cout << "after last catch block" << '\n';
}
